package tech.aichan.AiQA.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import tech.aichan.AiQA.model.entity.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select role.* from role left join" +
            "    (select * from user_role where user_id = #{id})" +
            "    as ur" +
            "    on role.id = ur.role_id")
    List<Role> listRoleByUserId(Long id);
}
